package com.harmonk.firstscene.db.entity

import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey

@Entity(
    tableName = "persons", indices = [Index(value = ["personId"], unique = true), Index(value = ["eventId"])],
    foreignKeys = [
        ForeignKey(
            entity = TrafficEvent::class,
            parentColumns = ["eventId"],
            childColumns = ["eventId"],
            onDelete = ForeignKey.CASCADE
        )]
)
data class Person(
    @PrimaryKey(autoGenerate = true)
    val personId: Long = 0,
    val name: String = "",
    val seat: Int = 0,
    val sfzId: String = "",
    val phone: Long = 0,
    val memo: String = "",
    val eventId: Long = -1,
    val vehicleId: Long = -1
)